# Compilation diagnostic rules

Building diagnostic rules is similar to `ESLint` like lint tools, but different from it in that `ESLint` performs code scanning and is unrelated to the build process. In contrast, the code diagnostics here are closely related to the build process of `Rspack or Webpack`, incorporating many internal parameters generated during the build process to aid judgment, such as ModuleGraph, Webpack's internal markings for each module, and runtime added after code transformation, among others.

During the build process, if issues are discovered, they will be visible in the CLI and the final diagnostic summary webpage, as shown below:

<img
  width="700"
  style={{ margin: '10px auto' }}
  src="https://assets.rspack.rs/others/assets/rsdoctor/rule-config-cli.png"
/>

<img
  width="700"
  style={{ margin: '10px auto' }}
  src="https://assets.rspack.rs/others/assets/rsdoctor/bundle-alerts.png"
/>

## How to use

Currently, Rsdoctor provides **built-in rules** and **custom rules**.

### Built-in Rules

The existing diagnostic tool includes multiple rules, all of which are enabled by default. They are:

1. [[E1001] Duplicate Packages](/guide/rules/rules#e1001-duplicate-packages)
2. [[E1002] Cross Chunks Package](/guide/rules/rules#e1002-cross-chunks-package)
3. [[E1003] Loader Performance Optimization](/guide/rules/rules#e1003-loader-performance-optimization)
4. [[E1004] ECMA Version Check](/guide/rules/rules#e1004-ecma-version-check)
5. [[E1005] Default Import Check](/guide/rules/rules#e1005-default-import-check)

For specific details, refer to [Built-in Rules](/guide/rules/rules).

### Custom rules

Rsdoctor also collects analyzed data and allows users to integrate custom rules through the Linter API. For details on custom rules, refer to [Custom Rules](/guide/rules/rule-custom).
